package com.xquant.databasemanagement.bean;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class SequenceBean extends DataBaseObject {

    private String sequenceMinValue;

    private String sequenceMaxValue;

    private String sequenceStep;

    private String sequenceStartValue;

    private String sequenceCacheSize;

    private boolean isCycle = false;

    @JacksonXmlProperty(isAttribute = true)
    public String getSequenceMinValue() {
        return sequenceMinValue;
    }

    @JacksonXmlProperty(isAttribute = true)
    public void setSequenceMinValue(String sequenceMinValue) {
        this.sequenceMinValue = sequenceMinValue;
    }

    @JacksonXmlProperty(isAttribute = true)
    public String getSequenceMaxValue() {
        return sequenceMaxValue;
    }

    @JacksonXmlProperty(isAttribute = true)
    public void setSequenceMaxValue(String sequenceMaxValue) {
        this.sequenceMaxValue = sequenceMaxValue;
    }

    @JacksonXmlProperty(isAttribute = true)
    public String getSequenceStep() {
        return sequenceStep;
    }

    @JacksonXmlProperty(isAttribute = true)
    public void setSequenceStep(String sequenceStep) {
        this.sequenceStep = sequenceStep;
    }

    @JacksonXmlProperty(isAttribute = true)
    public String getSequenceStartValue() {
        return sequenceStartValue;
    }

    @JacksonXmlProperty(isAttribute = true)
    public void setSequenceStartValue(String sequenceStartValue) {
        this.sequenceStartValue = sequenceStartValue;
    }

    @JacksonXmlProperty(isAttribute = true)
    public String getSequenceCacheSize() {
        return sequenceCacheSize;
    }

    @JacksonXmlProperty(isAttribute = true)
    public void setSequenceCacheSize(String sequenceCacheSize) {
        this.sequenceCacheSize = sequenceCacheSize;
    }

    @JacksonXmlProperty(isAttribute = true)
    public boolean getCycle() {
        return isCycle;
    }

    @JacksonXmlProperty(isAttribute = true)
    public void setCycle(boolean cycle) {
        isCycle = cycle;
    }


    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj==null)
            return false;
        if (obj instanceof SequenceBean){
            SequenceBean sequenceBean = (SequenceBean)obj;

            return sequenceBean.getSequenceCacheSize().equals(this.getSequenceCacheSize()) &&
                    sequenceBean.getSequenceMaxValue().equals(this.getSequenceMaxValue()) &&
                    sequenceBean.getSequenceMinValue().equals(this.getSequenceMinValue()) &&
                    sequenceBean.getSequenceStep().equals(this.getSequenceStep()) &&
                    sequenceBean.getSequenceStartValue().equals(this.getSequenceStartValue()) &&
                    sequenceBean.getName().equals(this.getName()) &&
                    (sequenceBean.getCycle() == this.getCycle());
        }
        return false;
    }




}
